package com.dzpk.gameserver.net;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import somnus.task.ITask;
import somnus.task.ITaskAspect;

public class GameServerTaskAspect implements ITaskAspect {

    private static final Logger logger = LoggerFactory.getLogger("command_execute_listener");

    @Override
    public void afterExecute(ITask task) {

    }

    @Override
    public void beforeExecute(ITask task) {
        // 任务创建时间
        long exeTime = System.nanoTime();
        long createTime = task.getCreateTime();

        double cost = (exeTime - createTime) * 0.000001;
        int best = 20;
        // 大于10毫秒
        if (cost > best) {
            logger.info(String.format("wait message %s  wait %sms  > %s", task.getDesc(), cost, best));
        }
    }
}
